exports.__esModule = true;

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

exports.default = class extends think.BaseController {
    /**
     * 通过businesskey查询所有案件信息
     * @param {String} businesskey          部件id
     * @returns
     */
    queryCaseByKeyAction() {
        var _this = this;

        return _asyncToGenerator(function* () {
            const aj = think.ajaxJson();
            const getData = {
                businesskey: _this.get('businesskey')
            };
            const CaseService = _this.service('oa/CaseService');
            const res = yield CaseService.getCaseByKey(getData);
            if (!res.error) {
                aj.result = res;
            } else {
                aj.success = false;
                aj.msg = '查询失败';
            }
            return _this.json(aj);
        })();
    }
    /**
     * 查询案件信息
     *
     * @returns
     */
    queryCaseAllAction() {
        var _this2 = this;

        return _asyncToGenerator(function* () {
            const aj = think.ajaxJson();
            const CaseService = _this2.service('oa/CaseService');
            const res = yield CaseService.getCaseAll(_this2.getUser());
            if (!res.error) {
                aj.result = res;
            } else {
                aj.success = false;
                aj.msg = '查询失败';
            }
            return _this2.json(aj);
        })();
    }
    /**
     * 通过porcid查询案件信息
     * @returns
     */
    queryCaseByProcIdAction() {
        var _this3 = this;

        return _asyncToGenerator(function* () {
            const aj = think.ajaxJson();
            const CaseService = _this3.service('oa/CaseService');
            const proc_inst_id = _this3.post('proc_inst_id');
            const res = yield CaseService.getCaseByProcId(proc_inst_id);
            if (!res.error) {
                aj.result = res;
            } else {
                aj.success = false;
                aj.msg = '查询失败';
            }
            return _this3.json(aj);
        })();
    }

    /**
     * 部门评价
     */
    getOrgEvalAction() {
        var _this4 = this;

        return _asyncToGenerator(function* () {
            const aj = think.ajaxJson();
            const CaseService = _this4.service('oa/CaseService');
            const data = {
                orgList: _this4.get('orgList')
            };
            const res = yield CaseService.getOrgEval(data);
            if (!res.error) {
                aj.result = res;
            } else {
                aj.success = false;
                aj.msg = '查询失败';
            }
            return _this4.json(aj);
        })();
    }

    getCaseViaAction() {
        var _this5 = this;

        return _asyncToGenerator(function* () {
            const aj = think.ajaxJson();
            const CaseService = _this5.service('oa/CaseService');
            const data = _this5.get('page,pageSize,remarks,case_type,time,area_code,DeptCodes,case_code,parent_name');
            const res = yield CaseService.getCaseViaAll(data, _this5.getUser());
            if (!res.error) {
                aj.result = res;
            } else {
                aj.success = false;
                aj.msg = '查询失败';
            }
            return _this5.json(aj);
        })();
    }

    getPartsCaseAction() {
        var _this6 = this;

        return _asyncToGenerator(function* () {
            const aj = think.ajaxJson();
            const CaseService = _this6.service('oa/CaseService');
            const data = _this6.post('page,pageSize,area_code,startTime,endTime');
            const res = yield CaseService.getPartsCase(data, _this6.getUser());
            if (!res.error) {
                aj.result = res;
            } else {
                aj.success = false;
                aj.msg = '查询失败';
            }
            return _this6.json(aj);
        })();
    }
};